package com.qing.design.patterns.bridge.example.remotes;

import com.qing.design.patterns.bridge.example.devices.Device;

public class BasicRemote implements  Remote{

	protected Device device;

	public BasicRemote() {
	}

	public BasicRemote(Device device) {
		this.device = device;
	}

	@Override
	public void power() {
		System.out.println("远程：电源切换");
		if(device.isEnabled()){
			device.disable();
		}else{
			device.enable();
		}
	}

	@Override
	public void volumeDown() {
		System.out.println("远程：音量降低");
		device.setVolume(device.getVolume()-10);
	}

	@Override
	public void volumeUp() {
		System.out.println("远程音量增高");
		device.setVolume(device.getVolume()+10);
	}

	@Override
	public void channelDown() {
		System.out.println("远程减频道");
		device.setChannel(device.getChannel()-1);
	}

	@Override
	public void channelUp() {
		System.out.println("远程加频道");
		device.setChannel(device.getChannel()+1);
	}
}
